<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="accessory" uri="http://accessoryPackageTag.weitu.net" %>
<%@taglib uri="http://workflowReviewTag.weitu.net" prefix="flow" %>
<!--工作流审批处理标签-->
<!doctype html>
<html lang="zh">
<head>
    <title>业务表单</title>
    <%@include file="/common/header.jspf" %>
    <script type="text/javascript">
        var loginUserName = '${loginUser.name}';
        var loginUserId = '${loginUser.id}';
        var deptId = '${info.deptId}';
        var reportYearth = '${info.reportYearth}';
        var reportMonth = '${info.reportMonth}';
    </script>
    <SCRIPT src="${ctx}/resources/js/accidentEvent/accidentMonthReport/detail.js" type="text/javascript"></SCRIPT>
    <style>
        .flow_review {

            width: 100%;
            margin-bottom: 20px;
        }

        .flow_review .review_title {
            width: 100px;
            text-align: right;
        }

        .flow_review > table {
            width: 100%;
        }

        .flow_review label {
            float: left;
            width: 50px;
        }

        .flow_review label > input {
            width: 10px;
        }

        .flow_review textarea {
            width: 80%;
        }

        .flow_review .review_next_check {
            width: 100%;
        }

        /*.flow_review .review_result{
            padding-left:20%;
            height:30px;
            line-height:30px;
        }
        .flow_review .review_result>label{
            width:50px;
            float:left;
        }
        .flow_review .review_result>label>input{
            width:10px;
        }
        .flow_review  .review_comments{
            height:auto;
        }
        .flow_review  .review_comments>textarea{
            margin-left:10%;
            width:80%;
        }*/
    </style>
</head>
<body>
<div class="menu-right" style="">
    <a class="button icon-save" id="btn_save">
        保存
    </a>
    <%-- <a class="button icon-refer" id="">
       提交
   </a>--%>
    <%--<a class="button icon-export">
        导入
    </a>--%>
</div>
<form id="infoForm" method="post">
    <input type="hidden" name="id" value="${info.id}">
    <div class="information">
        <div class="information-title">
            <p>事故月报基本信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="">
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">部门名称:</label>
                    <input class="easyui-datebox" style="width: 240px;" editable="false" name="deptId"
                           required="true" value="${info.deptName}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one" style="">
                    <label class="lable-style">年度:</label>
                    <input type="text" class="easyui-textbox" style="width: 240px;" required="true" name="reportYearth"
                           value="${info.reportYearth}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">月份:</label>
                    <input id="happenDeptId" class="easyui-textbox" style="width: 240px;" name="reportMonth"
                           value="${info.reportMonth}" readonly>
                    <span>*</span>
                </div>
            </div>

        </div>
    </div>
    <div class="information">
        <div class="information-title">
            <p>事故列表信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="enclosure" style="height:300px; ">
            <table id="accidentList">
            </table>
        </div>
    </div>


</form>
<%--审核信息--%>
<form id="verifyForm">
    <input type="hidden" name="businessId" value="${info.id}">
    <input type="hidden" name="workItemId" value="${workItemId}"/>
    <input type="hidden" name="step" value="${step}"/>
    <div class="information" style="">
        <div class="information-title">
            <p>审批信息</p>
            <a href="#"><img src="${ctx}/resources/themes/images/alias_03.png" width="18"></a>
        </div>
        <div class="input-wrap">
            <!--工作流审批意见-->
            <flow:review requestName="workflowReview" workItemId="${workItemId}"/>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {
        /***
         * 审批操作
         */
        $('#btn_save').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data = $("#verifyForm").serializeJson();
            if (!checkVerifyResult('workflowReview')) {
                $.messager.progress('close');
                return false;
            }
            //表单提交
            $('#verifyForm').form('submit', {
                url: ROOT_PATH + '/accidentEvent/accidentMonthReport/verifyApplication.shtml',
                data: data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    } catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                    if (result.success) {
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message, {time: 1000, icon: 1}, function () {
                            WindowManager.closeLayer();//关闭窗口
                        });
                    } else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                }
            });
        });
    });
</script>
</html>
